﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.Composition;
using Core.DataAccess;
using Core.DataAccess.IRepositories;
using Core.DataAccess.Repositories;
using Core.Common;
using Core.BusinessLogic.Interfaces;
using Core.Interfaces;

namespace Core.BusinessLogic
{
    [Export(typeof(IPermissionService))]
    public class PermissionService : IPermissionService
    {
        [Import]
        private IPermissionRepository _permissionRepository;

        public PermissionService()
        {
            MEFManager.Compose(this);
        }

        public List<Permission> GetPermissionsByAccountID(Int32 AccountID)
        {
            return _permissionRepository.GetPermissionsByAccountID(AccountID);
        }

        public List<Permission> GetPermissionByName(string Name)
        {
            return _permissionRepository.GetPermissionByName(Name);
        }

        public List<Permission> GetPermissionByID(Int32 PermissionID)
        {
            return _permissionRepository.GetPermissionByID(PermissionID);
        }

        public void SavePermission(Permission permission)
        {
            _permissionRepository.SavePermission(permission);
        }

        public void DeletePermission(Permission permission)
        {
            _permissionRepository.DeletePermission(permission);
        }
    }
}
